package com.sxj.corejava.code13_JDBC;

public class Emp {

    private Integer id;
    private String name;
    private Double salary;
    // 对于外键字段,可以直接写字段名
    private Integer deptId;
    // 但是在实际开发中,一般通过对象来进行维护
    // 此时可以使用外键所在的表所定的对象来作为属性
    private Dept dept;

//    @Override
//    public String toString() {
//        return "Emp{" +
//                "id=" + id +
//                ", name='" + name + '\'' +
//                ", salary=" + salary +
//                ", dept=" + dept +
//                '}';
//    }

    @Override
    public String toString() {
        return "Emp{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                '}';
    }

    public Emp() {
    }

    public Emp(String name, Double salary, Dept dept) {
        this.name = name;
        this.salary = salary;
        this.dept = dept;
    }

    public Emp(String name, Double salary, Integer deptId) {
        this.name = name;
        this.salary = salary;
        this.deptId = deptId;
    }

    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }
}
